Skip to content

chore: enforce ruff docstring rules in integrations 31-40 (openrouter, opensearch, optimum, paddleocr, pgvector, pinecone, pyversity, qdrant, ragas, snowflake)#3011

Merged
julian-risch merged 3 commits intomainfrom
feat/docstring-ruff-rules-batch4
Mar 24, 2026
Merged

chore: enforce ruff docstring rules in integrations 31-40 (openrouter, opensearch, optimum, paddleocr, pgvector, pinecone, pyversity, qdrant, ragas, snowflake)#3011
julian-risch merged 3 commits intomainfrom
feat/docstring-ruff-rules-batch4

Conversation

@julian-risch
Copy link
Copy Markdown
Member

@julian-risch julian-risch commented Mar 20, 2026

Related Issues

Closes #2947

Part 4/5. Last open PR.

Proposed Changes:

  • Adds ruff pydocstyle rules D102, D103, D205, D209, D213, D417, D419 to pyproject.toml for 10 integrations: openrouter, opensearch, optimum, paddleocr, pgvector, pinecone, pyversity, qdrant, ragas, snowflake
  • Fixes all resulting docstring violations (D205 — blank line between summary and description; D102/D103 — missing docstrings on public methods/functions)
  • D213/D209 violations were auto-fixed by ruff --fix; D205/D102/D103 violations fixed with Claude Code
  • Added "D" to examples/** per-file-ignores where example directories exist
  • pyversity needed no source code changes (only pyproject.toml)
  • Made one pinecone test more robust that was flaky. The conftest.py wraps delete_documents_async to sleep after deletion, but delete_all_documents_asyncdid not have the wrapper yet

How did you test it?

Ran tests locally

Notes for the reviewer

This is batch 4 of the docstring rules enforcement. Previous batches: #3008, #3009, #3010.

I thought about adding D107, which is not mentioned in the issue. D107 checks that __init__ method definitions have docstrings. I could open one separate PR that adds D107 to all integrations and one PR to add it to Haystack if we agree its beneficial. For consistency it makes sense but there is not much value added but the __init__ docstrings so it's not of importance.

Checklist

…19) in integrations 31-40

Adds D102, D103, D205, D209, D213, D417, D419 ruff rules to pyproject.toml
for: openrouter, opensearch, optimum, paddleocr, pgvector, pinecone,
pyversity, qdrant, ragas, snowflake. Fixes all resulting docstring violations.

Part of #2947

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ftest

Pinecone's eventual consistency requires a delay after deletions before
counts reflect the change. The conftest already wrapped delete_documents_async
with a sleep, but missed delete_all_documents_async, causing a flaky test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@julian-risch julian-risch marked this pull request as ready for review March 23, 2026 08:34
@julian-risch julian-risch requested a review from a team as a code owner March 23, 2026 08:34
@julian-risch julian-risch requested review from bogdankostic and removed request for a team March 23, 2026 08:34
@julian-risch julian-risch enabled auto-merge (squash) March 23, 2026 08:35
Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good in principle! I just left two minor comments regarding a grammatical fix and docstring consistency within a file.

While reviewing, I was wondering: do we have a convention for the verb forms we use in our docstrings? I noticed we currently mix the third-person singular ("Creates a new OpenSearchDocumentStore instance.") and the imperative/infinitive ("Initialize the OpenSearchHybridRetriever...").

@julian-risch
Copy link
Copy Markdown
Member Author

While reviewing, I was wondering: do we have a convention for the verb forms we use in our docstrings? I noticed we currently mix the third-person singular ("Creates a new OpenSearchDocumentStore instance.") and the imperative/infinitive ("Initialize the OpenSearchHybridRetriever...").

We're not as consistent as we could be and we're not enforcing this throughout the code base but convention is to follow https://developers.google.com/style/reference-verbs
Third-person singular is preferred.

Co-authored-by: bogdankostic <bogdankostic@web.de>
@julian-risch julian-risch merged commit 5e5e7a7 into main Mar 24, 2026
64 checks passed
@julian-risch julian-risch deleted the feat/docstring-ruff-rules-batch4 branch March 24, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce Ruff docstring rules

2 participants